(1) Field of the Invention
This invention relates to a record medium and a method for analyzing a source file and, more particularly, to a computer-readable record medium which stores a program for having a computer perform the process of analyzing a source file described in an object-oriented language and such a source file analyzing method.
(2) Description of the Related Art
Conventionally, when a source file described in a procedural language, such as COBOL (common business oriented language), is, for example, debugged or updated, program portions affected by the debug or update are specified and care is taken so that these portions do not malfunction.
FIGS. 32(A) and 32(B) are views for describing an influence search function called cross reference which has conventionally been used to specify a portion influenced by a change made in a source file. FIG. 32(A) shows a source file to be changed. In this example, program A and program C use COPY Al and subroutine B (PROGRAM SUB B).
Making an influence search on this source file will produce results like the ones shown in FIG. 32(B). In this example, each column shows the type of a program, each row shows COPY used, and fields where the use relationship exists are marked with xe2x80x9c∘xe2x80x9d By using such a table, it can be understood immediately that, for example, program A and program C use COPY A1.
With such a procedural language, the structure of a main program calling a common function (subroutine or component, for example) is clear and the uniqueness of a call name is guaranteed. The influence of a change therefore can be specified on the basis of one-to-one cross reference.
With object-oriented languages, being the mainstream in recent years, however, a program is defined as a class having an attribute (data) and operation (method), is substantiated as an object on a computer, and operates by exchanging messages with other objects.
With object-oriented languages, a child class (subclass) can inherit an attribute and operation from its parent class (superclass) by inheritance. In such a mechanism, when a class is changed, it is necessary to examine the reference situation not only for that child class but also for the lower classes (grandchild class, great-grandchild class, and so forth). This is not a one-to-one correspondence, so it is difficult to grasp the scope of the influence.
Furthermore, object-oriented languages enable what is called xe2x80x9coverloading,xe2x80x9d that is to say, to multiply define classes (or methods) of the same name the arguments of which differ in number or type. Moreover, they enable what is called xe2x80x9coverriding,xe2x80x9d that is to say, to redefine a method or member variable for a superclass in its subclass. Under these circumstances operation names (method names) do not necessarily correspond to the contents of processes on a one-to-one basis. Therefore, it is difficult to specify a reference relationship only by an operation name.
Conventionally, owing to these problems peculiar to object-oriented languages, relationships among classes or the use relationships of classes have been examined manually by reference to design documents etc. This involves a great deal of labor and increases the possibility of a miss caused by, for example, carelessness. As a result, debugging a program takes much time.
In addition, it is difficult to examine reference relationships among classes, so an unused class may remain after a program is changed. In such a case, resources are consumed unnecessarily.
In order to address such problems, the present invention was made. In other words, an object of the present invention is to provide a source file analyzing method that can easily make an influence search in an object-oriented language and a record medium on which a program for having a computer use such a method is recorded.
In order to achieve the above object, a source file analyzing method for analyzing a source file described in an object-oriented language is provided. This source file analyzing method comprises an inputting step for inputting a source file to be analyzed, a reference relationship examining step for examining the reference relationships of classes included in the source file input by the inputting step, and an influenced class specifying step for specifying a class influenced by a change made in a predetermined class on the basis of results obtained through examinations by the reference relationship examining step.
The above and other objects, features and advantages of the present invention will become apparent from the following description when taken in conjunction with the accompanying drawings which illustrate preferred embodiments of the present invention by way of example.